package wang.yangziqing.app_kotlin.adapter

import android.support.v7.widget.RecyclerView
import android.view.View
import android.view.ViewGroup
import android.widget.ImageView
import com.chad.library.adapter.base.BaseQuickAdapter
import com.chad.library.adapter.base.BaseViewHolder
import com.squareup.picasso.Picasso
import com.yan.mobile.player.model.HomeItemBean
import kotlinx.android.synthetic.main.item_home.view.*
import wang.yangziqing.app_kotlin.R
import wang.yangziqing.app_kotlin.weight.HomeItemView

/**
 * Created by Administrator on 2017/11/29.
 */
public class HomeAdapter(layoutResId: Int, data: List<HomeItemBean>?) : BaseQuickAdapter<HomeItemBean, BaseViewHolder>(layoutResId, data) {


    override fun convert(helper: BaseViewHolder?, item: HomeItemBean?) {
        helper?.setText(R.id.title, item?.title)?.setText(R.id.desc, item?.description)
        val view = helper?.getView<ImageView>(R.id.bg)
        Picasso.with(view?.context)
                .load(item?.posterPic)
                .into(view)

    }

}